The present invention relates to a method of and an apparatus for transmitting data into and out of a computer or the like, suitable for use in a disk drive such as a hard disk drive, an optical disk drive, a magnetooptical disk drive, or the like.
Disk drives such as optical disk drives, which are connected to computers or the like for storing various data produced by the computers on disks, have widely been used as data input/output apparatus in the prior art.
FIG. 1 of the accompanying drawings shows functional blocks of software functions stored in an optical disk drive. Processing operation of a CPU of the optical disk drive will be described below with reference to FIG. 1. Since the software functions are represented by respective functional block in FIG. 1, the software functions are given hardware titles in FIG. 1.
As shown in FIG. 1, the software system includes a system controller P1 for controlling the system in its entirety, a memory controller P2 for controlling a work memory, an I/O (input/output) driver P3 for inputting and outputting input/output data P4, P5, P6 with tasks TASK#1, TASK#2, TASK#3, and a data transfer buffer P11 for transferring data.
The system controller P1 is a software task referred to as TASK#0 as a main manager for controlling the system while determining whether the I/O driver P3 is normal or not, setting a DMA control circuit, or monitoring data as they are inputted into and out of the work memory and a buffer memory. The tasks TASK#1, TASK#2, TASK#3 are carried out in an SCSI (Small Computer Systems Interface) environment. The memory controller P2 is a memory manager as a so-called test driver.
A multitask monitor P8 is a software function for operating the tasks TASK#1, TASK#2, TASK#3 apparently simultaneously, and has two features. One of the features is that each software module can be designed uniquely without concern over various factors. The other feature is that a software sequence corresponding to an abruptly occurring event can easily be generated and modified because each of the tasks TASK#1, TASK#2, TASK#3 is of a structure which keeps a waiting condition until an event corresponding to each of the tasks occurs. Due to these features, the multitask monitor P8 is employed in many devices. Denoted at P9-1, P9-2, P9-3 are hardware-initiated interrupt routines.
Operation of the optical disk drive, particularly the software system shown in FIG. 1, will be described below with reference to FIGS. 2 and 3.
FIGS. 2 and 3 show an operation sequence caused by the system controller P1 shown in FIG. 1 and an operation sequence of the optical disk drive caused by the I/O driver P3 shown in FIG. 1.
In a step S1, the system controller P1 calls the I/O driver to cause the I/O driver to wait for a command. Specifically, when the system controller P1 enters a state of receiving a command, the system controller P1 calls the I/O driver P3 directing it to wait for a command. Then, the I/O driver P3 enters a state of waiting for a command in a step S2.
When the I/O driver P3 receives a command, the system controller P1 analyzes the command in a step S3, and control goes to step S4 or step S5 depending on the analyzed command. Specifically, the system controller P1 analyzes a command from a host computer, and if the command is a data transfer command, then control goes to step S4, and if the command is not a data transfer command, then control goes to step S5.
In step S4, a data transfer memory is acquired, after which control proceeds to step S6. That is, preparations are made in order to be able to use a buffer memory.
In step S5, a command other than the data transfer command is processed. Thereafter, control returns to step S1.
In step S6, a task of a source I/O driver is started, and DMA (direct memory access) transfer is started between the data transfer memory and an I/O, after which control goes to step S8 shown in FIG. 3. That is, the I/O driver P3 (in FIG. 1) effects DMA transfer to the buffer memory.
In step S7, the DMA transfer is started in the I/O driver P3, and an interrupt indicating the end of the DMA transfer is awaited. After step S7, control goes to step S8.
In step S8, a task of the destination I/O driver is started, and DMA transfer is started between the data transfer memory and an I/O, after which control goes to step S9. That is, when the system controller P1 (FIG. 1) recognizes that a certain amount of data is stored in the buffer memory, the system controller P1 starts a task of the I/O driver P3.
In step S9, the DMA transfer is started, and an interrupt indicating the end of the DMA transfer is awaited. Specifically, the destination I/O driver P3 starts DMA transfer from the buffer memory to an I/O, i.e., to an input or output side. When the DMA transfer is ended, the I/O driver P3 informs the system controller P1 of the end of the DMA transfer. The system controller P1 then waits for an end of the data transfer in step S10. If the data transfer ends, then control goes to step S11, and if the data transfer does not end, then control goes to step S6 shown in FIG. 2. Specifically, since all data may not be transferred in one transfer cycle, the system controller P1 controls source and destination I/O drivers P3 to effect DMA transfer while monitoring the DMA transfer of the source and destination I/O drivers P3 until all data to be transferred from the destination I/O driver P3 are transferred from the buffer memory to a destination I/O by the destination I/O driver P3.
In step S11, an end status is given to the I/O drivers, after which control goes back to step S1 shown in FIG. 2. That is, a status indicative of the end of the DMA transfer is given to the source I/O driver P3 and the destination I/O driver P3.
In step S12, the I/O driver P3 reports the result to the I/O which has issued the command. Thereafter, control returns to step S1 shown in FIG. 2. That is, the host computer is informed of the end of the data transfer.
When the processing of the command is finished, the system controller P1 waits for a command again.
In order to carry out the above operation effectively, the tasks TASK#1, TASK#2, TASK#3 are assigned respectively to the I/O data P4, P5, P6, respectively, and the multitask monitor P8 shown in FIG. 1 is operated.
The conventional data input/output apparatus described above suffers the following problems:
First, if there are a number of I/O drivers P3 which receive commands, then the software sequence for the system controller shown in FIG. 1 becomes more complex as the number of I/O drivers P3 increases. Inasmuch as it is necessary to monitor whether there is a command from another I/O while a command received by the software sequence for the system controller is being processed, the software sequence for the system controller is essentially of a complex nature.
Secondly, the functional level of the entire system is constrained by the designing capability because the system controller P1 is required to operate while determining the type (source or destination, for example) and status of the tasks of the I/O drivers P3.
The third problem is that when a bug occurs in a certain I/O driver P3, or the software sequence needs to be modified for a functional expansion, no correct change can be made unless the designer understands the overall software sequence.
According to the fourth problem, if a plurality of designers are assigned to design and develop a software system for one storage apparatus, then the software system cannot be designed and developed unless locations for exchanging information between software sequences, including I/O driver interfaces, are clearly indicated.
The fifth drawback is that when a new system is constructed, it has to be newly designed in its entirety.
According to the sixth disadvantage, the number of I/Os that can be handled is limited because the greater the number of tasks that can be controlled by the multitask monitor P8, the slower the processing speed of the system.
According to the seventh problem, since tasks of several I/O drivers cannot be generated independently of each other, all tasks of I/O drivers have to be generated in relation to each other.